import React, { useEffect, useState } from "react";

export const useDark = () => {
  const [dark, setDark] = useState(false);
  useEffect(() => {
    if (typeof window !== "undefined") {
      const isDark = JSON.parse(localStorage.getItem("isDark"));
      setDark(isDark);
    }
  }, []);
  return dark;
};
